pyostbuilddir=$(libdir)/ostbuild/pyostbuild
pyostbuild_PYTHON = \
src/ostbuild/pyostbuild/buildutil.py \
- src/ostbuild/pyostbuild/builtin_bin_to_src.py \
src/ostbuild/pyostbuild/builtin_branch_prefix.py \
src/ostbuild/pyostbuild/builtin_build_components.py \
src/ostbuild/pyostbuild/builtin_checkout.py \
src/ostbuild/pyostbuild/builtin_prefix.py \
src/ostbuild/pyostbuild/builtin_resolve.py \
src/ostbuild/pyostbuild/builtin_modify_snapshot.py \
- src/ostbuild/pyostbuild/builtin_tree_to_bin.py \
+ src/ostbuild/pyostbuild/builtin_tree_to_src.py \
src/ostbuild/pyostbuild/builtin_init.py \
src/ostbuild/pyostbuild/builtin_status.py \
src/ostbuild/pyostbuild/builtins.py \
+++ /dev/null
-# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# ostbuild-compile-one-make wraps systems that implement the GNOME build API:
-# http://people.gnome.org/~walters/docs/build-api.txt
-
-import os,sys,stat,subprocess,tempfile,re,shutil
-import argparse
-from StringIO import StringIO
-import json
-
-from . import builtins
-from .ostbuildlog import log, fatal
-from .subprocess_helpers import run_sync, run_sync_get_output
-from . import buildutil
-
-class OstbuildBinToSrc(builtins.Builtin):
- name = "bin-to-src"
- short_description = "Turn a binary snapshot into a source snapshot"
-
- def __init__(self):
- builtins.Builtin.__init__(self)
-
- def bin_snapshot_to_src(self, bin_snapshot):
- del bin_snapshot['00ostree-bin-snapshot-version']
-
- src_snapshot = dict(bin_snapshot)
- src_snapshot['00ostree-src-snapshot-version'] = 0
-
- all_architectures = src_snapshot['architecture-buildroots'].keys()
- # Arbitrarily take first architecture
- first_arch = all_architectures[0]
-
- bin_components = src_snapshot['components']
- src_components = {}
- src_snapshot['components'] = src_components
- for archname,rev in bin_components.iteritems():
- (name, arch) = archname.rsplit('/', 1)
- if arch != first_arch:
- continue
- meta = dict(self.get_component_meta_from_revision(rev))
- del meta['name']
- src_components[name] = meta
-
- for target in src_snapshot['targets']:
- for content_item in target['contents']:
- name = content_item['name']
- rev = bin_components[name]
- content_item['ostree-revision'] = rev
-
- return src_snapshot
-
- def execute(self, argv):
- parser = argparse.ArgumentParser(description=self.short_description)
- parser.add_argument('--prefix')
- parser.add_argument('--bin-snapshot')
-
- args = parser.parse_args(argv)
- self.parse_config()
- self.parse_bin_snapshot(args.prefix, args.bin_snapshot)
-
- snapshot = self.bin_snapshot_to_src(self.bin_snapshot)
- db = self.get_src_snapshot_db()
- path = db.store(snapshot)
- log("Source snapshot: %s" % (path, ))
-
-builtins.register(OstbuildBinToSrc)
bin_snapshot = dict(self.snapshot)
del bin_snapshot['00ostree-src-snapshot-version']
- bin_snapshot['00ostree-bin-snapshot-version'] = 0
+ bin_snapshot['00ostree-bin-snapshot-version'] = 1
for target in bin_snapshot['targets']:
base = target['base']
for architecture in component_architectures[name]:
component_refs.append('components/%s/%s' % (name, architecture))
- new_components = {}
+ component_revisions = {}
resolved_refs = self._resolve_refs(component_refs)
for name,rev in zip(components.iterkeys(), resolved_refs):
for architecture in component_architectures[name]:
archname = '%s/%s' % (name, architecture)
- new_components[archname] = rev
+ component_revisions[archname] = rev
- bin_snapshot['components'] = new_components
+ bin_snapshot['component-revisions'] = component_revisions
path = self.get_bin_snapshot_db().store(bin_snapshot)
log("Binary snapshot: %s" % (path, ))
parser.add_argument('--prefix')
parser.add_argument('--src-snapshot')
parser.add_argument('--compose', action='store_true')
+ parser.add_argument('--compose-only', action='store_true')
parser.add_argument('--start-at')
parser.add_argument('--shell-on-failure', action='store_true')
parser.add_argument('--debug-shell', action='store_true')
else:
start_at_index = 0
- for component_name in build_component_order[start_at_index:]:
- component = required_components[component_name]
- architectures = component_architectures[component_name]
- for architecture in architectures:
- self._build_one_component(component_name, component, architecture)
+ if not args.compose_only:
+ for component_name in build_component_order[start_at_index:]:
+ component = required_components[component_name]
+ architectures = component_architectures[component_name]
+ for architecture in architectures:
+ self._build_one_component(component_name, component, architecture)
self._save_bin_snapshot(required_components, component_architectures)
builtins.Builtin.__init__(self)
def _compose_one_target(self, bin_snapshot, target):
- components = bin_snapshot['components']
+ components = bin_snapshot['component-revisions']
base = target['base']
base_name = 'bases/%s' % (base['name'], )
base_revision = target['base']['ostree-revision']
+++ /dev/null
-# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# ostbuild-compile-one-make wraps systems that implement the GNOME build API:
-# http://people.gnome.org/~walters/docs/build-api.txt
-
-import os,sys,stat,subprocess,tempfile,re,shutil
-import argparse
-from StringIO import StringIO
-import json
-
-from . import builtins
-from .ostbuildlog import log, fatal
-from .subprocess_helpers import run_sync, run_sync_get_output
-from . import buildutil
-
-class OstbuildTreeToBin(builtins.Builtin):
- name = "tree-to-bin"
- short_description = "Turn a tree into a binary snapshot"
-
- def __init__(self):
- builtins.Builtin.__init__(self)
-
- def execute(self, argv):
- parser = argparse.ArgumentParser(description=self.short_description)
- parser.add_argument('--prefix')
- parser.add_argument('--tree')
-
- args = parser.parse_args(argv)
- self.parse_config()
- if args.prefix:
- self.prefix = args.prefix
-
- if args.tree:
- self.load_bin_snapshot_from_path(args.tree)
- else:
- self.load_bin_snapshot_from_current()
-
- db = self.get_bin_snapshot_db()
- path = db.store(self.bin_snapshot)
- log("Binary snapshot: %s" % (path, ))
-
-builtins.register(OstbuildTreeToBin)
--- /dev/null
+# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# ostbuild-compile-one-make wraps systems that implement the GNOME build API:
+# http://people.gnome.org/~walters/docs/build-api.txt
+
+import os,sys,stat,subprocess,tempfile,re,shutil
+import argparse
+from StringIO import StringIO
+import json
+
+from . import builtins
+from .ostbuildlog import log, fatal
+from .subprocess_helpers import run_sync, run_sync_get_output
+from . import buildutil
+
+class OstbuildTreeToSrc(builtins.Builtin):
+ name = "tree-to-src"
+ short_description = "Turn a tree into a source snapshot"
+
+ def __init__(self):
+ builtins.Builtin.__init__(self)
+
+ def bin_snapshot_to_src(self, bin_snapshot):
+ del bin_snapshot['00ostree-bin-snapshot-version']
+
+ src_snapshot = dict(bin_snapshot)
+ src_snapshot['00ostree-src-snapshot-version'] = 0
+
+ return src_snapshot
+
+ def execute(self, argv):
+ parser = argparse.ArgumentParser(description=self.short_description)
+ parser.add_argument('--prefix')
+ parser.add_argument('--tree')
+
+ args = parser.parse_args(argv)
+ self.parse_config()
+ if args.prefix:
+ self.prefix = args.prefix
+
+ if args.tree:
+ self.load_bin_snapshot_from_path(args.tree)
+ else:
+ self.load_bin_snapshot_from_current()
+
+ snapshot = self.bin_snapshot_to_src(self.bin_snapshot)
+ db = self.get_src_snapshot_db()
+ path = db.store(snapshot)
+ log("Source snapshot: %s" % (path, ))
+
+builtins.register(OstbuildTreeToSrc)
self.patchdir = os.path.join(self.workdir, 'patches')
def load_bin_snapshot_from_path(self, path):
- self.bin_snapshot_path = os.path.join(path, 'contents.json')
+ self.bin_snapshot_path = os.path.join(path, 'ostree-meta', 'contents.json')
+ if not os.path.exists(self.bin_snapshot_path):
+ self.bin_snapshot_path = os.path.join(path, 'contents.json')
self.bin_snapshot = json.load(open(self.bin_snapshot_path))
bin_ver = self.bin_snapshot['00ostree-bin-snapshot-version']
- if bin_ver != 0:
- fatal("Unhandled 00ostree-bin-snapshot-version \"%d\", expected 0", bin_ver)
+ if bin_ver != 1:
+ fatal("Unhandled 00ostree-bin-snapshot-version %r, expected 1" % (bin_ver, ))
def load_bin_snapshot_from_current(self):
if self.ostree_dir is None:
self.bin_snapshot_path = path
self.bin_snapshot = json.load(open(self.bin_snapshot_path))
bin_ver = self.bin_snapshot['00ostree-bin-snapshot-version']
- if bin_ver != 0:
- fatal("Unhandled 00ostree-bin-snapshot-version \"%d\", expected 0" % (bin_ver, ))
+ if bin_ver != 1:
+ fatal("Unhandled 00ostree-bin-snapshot-version %r, expected 1" % (bin_ver, ))
def execute(self, args):
raise NotImplementedError()
import argparse
from . import builtins
-from . import builtin_bin_to_src
from . import builtin_build_components
from . import builtin_branch_prefix
from . import builtin_checkout
from . import builtin_prefix
from . import builtin_resolve
from . import builtin_modify_snapshot
-from . import builtin_tree_to_bin
+from . import builtin_tree_to_src
from . import builtin_init
from . import builtin_status